<template>
  <div>
       <el-row style="background-color: white">
      <el-col :span="5">
        <a style="color: #606266" href="#">首页</a>
        <a style="color: #dcdfe6" href="#">/ 资产管理 </a>
        <a style="color: #dcdfe6" href="#">/ 楼栋信息</a></el-col
      >
    </el-row>
    <hr />
  <div style="background-color: white">
      <el-row >
      <el-col :span="2"><span style="font-family:'黑体';font-size:25px;font-weight:bold">业主信息</span></el-col>
    </el-row>
    <el-row>
        <el-col :span="2">
            业主编号：{{yezhuInfo.userId}}
        </el-col>
        <el-col :span="9">
            姓名：{{yezhuInfo.username}}
        </el-col>
        <el-col :span="5">
            性别：{{yezhuInfo.sex}}
        </el-col>
        <el-col :span="7">
            身份证：{{yezhuInfo.identitycard}}
        </el-col>
    </el-row>
    <el-row>
        <el-col :pull="0" :span="4">
            联系电话：{{yezhuInfo.tel}}
        </el-col>
        <el-col :span="5">
            创建员工：{{yezhuInfo.tadmin.username}}
        </el-col>
    </el-row>
  </div>
  <el-row >
      <el-col :span="3"><span style="font-family:'黑体';font-size:25px;font-weight:bold">业主房屋信息</span></el-col>
    </el-row>
  <template>
      <el-table :data="houseInfo" style="width: 100%">
        <el-table-column sortable prop="houseId" label="房屋ID" width="200">
        </el-table-column>
          <el-table-column prop="name" label="房屋门号" width="200">
        </el-table-column>
        <el-table-column prop="harea" label="面积" width="200">
        </el-table-column>
        <el-table-column prop="buildingId" label="楼栋编号" width="180">
        </el-table-column>
        <el-table-column label="操作" width="500" align=center> 
            <template slot-scope="scope">
              <el-button size="medium" @click="upd(scope.row)" round>房屋解绑</el-button>
        </template>
        </el-table-column>
      </el-table>
  </template>
  </div>
</template>

<script>
export default {
    data(){
        return{
                yezhuInfo:this.$store.state.yezhuInfo,
                houseInfo:{},
                };
    },
    methods:{
        upd(row){
            console.log(row);
            let url="yezhu/yezhu_update_house";
            let param={id:row.houseId};
            this.$axios.post(url,param).then(resp=>{if(resp.data.success){this.find()}});
        },
        find(){
            let url="yezhu/yezhu_select_house";
            let param={id:this.yezhuInfo.userId};
            this.$axios.post(url,param).then(resp=>{this.houseInfo=resp.data.result;console.log(this.houseInfo);});
        }
    },
    mounted(){
        this.find();
    }
}
</script>

<style>

</style>